package com.ruoyi.draw.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.draw.mapper.NovelChapterMapper;
import com.ruoyi.draw.domain.NovelChapter;
import com.ruoyi.draw.service.INovelChapterService;

/**
 * NovelChapterService业务层处理
 * 
 * @author Locke
 * @date 2025-10-25
 */
@Service
public class NovelChapterServiceImpl implements INovelChapterService 
{
    @Autowired
    private NovelChapterMapper novelChapterMapper;

    /**
     * 查询NovelChapter
     * 
     * @param id NovelChapter主键
     * @return NovelChapter
     */
    @Override
    public NovelChapter selectNovelChapterById(Long id)
    {
        return novelChapterMapper.selectNovelChapterById(id);
    }

    /**
     * 查询NovelChapter列表
     * 
     * @param novelChapter NovelChapter
     * @return NovelChapter
     */
    @Override
    public List<NovelChapter> selectNovelChapterList(NovelChapter novelChapter)
    {
        return novelChapterMapper.selectNovelChapterList(novelChapter);
    }

    /**
     * 新增NovelChapter
     * 
     * @param novelChapter NovelChapter
     * @return 结果
     */
    @Override
    public int insertNovelChapter(NovelChapter novelChapter)
    {
        novelChapter.setId(System.currentTimeMillis());
        novelChapter.setCreateBy(SecurityUtils.getUsername());
        novelChapter.setCreateTime(DateUtils.getNowDate());
        return novelChapterMapper.insertNovelChapter(novelChapter);
    }

    /**
     * 修改NovelChapter
     * 
     * @param novelChapter NovelChapter
     * @return 结果
     */
    @Override
    public int updateNovelChapter(NovelChapter novelChapter)
    {
        novelChapter.setUpdateBy(SecurityUtils.getUsername());
        novelChapter.setUpdateTime(DateUtils.getNowDate());
        return novelChapterMapper.updateNovelChapter(novelChapter);
    }

    /**
     * 批量删除NovelChapter
     * 
     * @param ids 需要删除的NovelChapter主键
     * @return 结果
     */
    @Override
    public int deleteNovelChapterByIds(Long[] ids)
    {
        return novelChapterMapper.deleteNovelChapterByIds(ids);
    }

    /**
     * 删除NovelChapter信息
     * 
     * @param id NovelChapter主键
     * @return 结果
     */
    @Override
    public int deleteNovelChapterById(Long id)
    {
        return novelChapterMapper.deleteNovelChapterById(id);
    }
}
